package ysw.action;

import static com.opensymphony.xwork2.Action.SUCCESS;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import ysw.jdbc.ObdJdbc;
import ysw.vo.Obd;

public class ObdAction extends ActionSupport{
	private Obd obd;

    public Obd getObd() {
        return obd;
    }

    public void setObd(Obd obd) {
        this.obd = obd;
    }
  
    private List<Obd> obdList;
    public String execute() throws Exception{
        ObdJdbc obdJ=new ObdJdbc();
        obd.setObdid(obd.getObdid());
        obd.setObdtype(obd.getObdtype());
        obd.setObddeal(obd.getObddeal());
 obdJ.addObd(obd);
       
        return SUCCESS;
    }
    

public String showAllObd(){
       Obd obd=new Obd();
       ObdJdbc obdJ=new ObdJdbc();
	
        try{
            obdList=obdJ.showObd();
        }catch(SQLException e){
            e.printStackTrace();
        }
    
		Map request=(Map)ActionContext.getContext().get("request");
        request.put("obdList",obdList);
        return SUCCESS;
    }
}
